package com.sc.reducer;

import java.io.IOException;

import org.apache.hadoop.io.LongWritable;
import org.apache.hadoop.io.Text;
import org.apache.hadoop.mapreduce.Reducer;

public class SortCombiner extends Reducer<Text, LongWritable, Text, LongWritable> {

	LongWritable l = new LongWritable();
	
	@Override
	protected void reduce(Text arg0, Iterable<LongWritable> arg1,
			Reducer<Text, LongWritable, Text, LongWritable>.Context arg2) throws IOException, InterruptedException {
		// TODO Auto-generated method stub
		long num = 0;
		for (LongWritable longWritable : arg1) {
			num += longWritable.get();
		}
		l.set(num);
		arg2.write(arg0, l);
	}
}
